import { StateCreator } from "zustand"
import { devtools } from "zustand/middleware"
import { immer } from "zustand/middleware/immer"

type MyMiddlewares = [["zustand/devtools", never], ["zustand/immer", never]]

const myMiddlewares = <T>(f: StateCreator<T, MyMiddlewares, []>): StateCreator<T, [], MyMiddlewares> =>
  devtools(immer(f))

export default myMiddlewares
